-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(tools): added workflow tools to agent tools dropdown for discoverability, enforce perms on client for redeploying via the agent #2778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rability, enforce perms on client for redeploying via the agent
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR adds workflow tools to the agent tools dropdown for improved discoverability and enforces admin permissions for workflow deployment operations. Key Changes
Integration with Existing CodeThe changes integrate with the existing workflow execution system:
Critical Issues Found
Confidence Score: 2/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant ToolInput as Tool Input Dropdown
participant Perms as Permission Context
participant WorkflowAPI as Workflow API
participant Agent as LLM Agent
Note over User,Agent: Workflow Discovery & Selection
User->>ToolInput: Opens tools dropdown
ToolInput->>ToolInput: Fetch available workflows
ToolInput->>ToolInput: Filter out current workflow
ToolInput->>User: Show "Workflows" section with workflow list
User->>ToolInput: Selects workflow from dropdown
ToolInput->>ToolInput: Create tool with type='workflow', toolId='workflow_executor'
Note over User,Agent: Deployment Permission Check (NEW)
User->>ToolInput: Clicks deploy badge
ToolInput->>Perms: Check userPermissions.canAdmin
alt User is NOT admin
Perms-->>ToolInput: canAdmin=false
ToolInput->>User: Show "cursor-not-allowed", tooltip: "Admin permission required"
else User IS admin
Perms-->>ToolInput: canAdmin=true
ToolInput->>WorkflowAPI: POST /api/workflows/{id}/deploy
WorkflowAPI-->>ToolInput: Deployment successful
ToolInput->>User: Update badge status
end
Note over User,Agent: Workflow Execution (CHANGED)
User->>Agent: Execute workflow with agent
Agent->>Agent: Check workflow_executor schema
Note right of Agent: workflowId is 'user-only'<br/>NOT in LLM schema
Agent->>Agent: Can only provide inputMapping<br/>Cannot select workflowId
Agent->>WorkflowAPI: Execute with user-selected workflow
WorkflowAPI-->>Agent: Return workflow results
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
Additional Comments (1)
Issue:
Impact:
This creates confusing duplication. The generic workflow block should remain hidden. Fix: Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx
Line: 1031:1045
Comment:
The `toolBlocks` filter doesn't respect the `hideFromToolbar` flag, which may cause the generic "Workflow" block to appear in the tools dropdown despite being marked as hidden.
**Issue:**
- The workflow block (`apps/sim/blocks/blocks/workflow.ts`) has `hideFromToolbar: true` (line 74)
- Line 1037 explicitly includes `block.type === 'workflow'` in the filter
- Line 850-866: `BUILT_IN_TOOL_TYPES` includes `'workflow'`
- Result: The workflow block would appear in the "Built-in Tools" section
**Impact:**
Users would see both:
1. A generic "Workflow" block in "Built-in Tools"
2. Individual workflow instances in the new "Workflows" section
This creates confusing duplication. The generic workflow block should remain hidden.
**Fix:**
Add a check to exclude blocks with `hideFromToolbar: true`:
```suggestion
const toolBlocks = useMemo(() => {
const allToolBlocks = getAllBlocks().filter(
(block) =>
!block.hideFromToolbar &&
(block.category === 'tools' ||
block.type === 'api' ||
block.type === 'webhook_request' ||
block.type === 'workflow' ||
block.type === 'knowledge' ||
block.type === 'function') &&
block.type !== 'evaluator' &&
block.type !== 'mcp' &&
block.type !== 'file'
)
return filterBlocks(allToolBlocks)
}, [filterBlocks])
```
How can I resolve this? If you propose a fix, please make it concise. |
Summary
Type of Change
Testing
Tested manually
Checklist